<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
</head>
<body>
<script>
// 把"   addfaafds  dfafdsadfsafsd ssd a "替换为："   addfaafds  dfafdsadfsafsd ssd a "
var str = "addfaafds  dfafdsadfsafsd ssd a ";
var str2 = trim(str);
console.info(str2)
function trim(str) {
  return str.replace(/^\s*|\s*$/g,"")
}

//作业1
	// $("#a"),$(".a"),$("span")
	function $(sele) {
		if(/^#\D/.test(sele)){
			console.log('id')
		}else if(/^\.\D/.test(sele)){
			console.log('class')
		}else if(/^[a-zA-Z]/.test(sele)){
			console.log('标签')
		}
	}
</script>
</body>
</html>